home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Localization Tools / SCM Verifier 1.0a12 / check-disk < prev    next >
Encoding:
Text File  |  1991-05-17  |  9.4 KB  |  276 lines  |  [TEXT/MPS ]

  1. #
  2. #    check-disk
  3. #    MPW Shell script
  4. #    Malcolm H. Teas
  5. #    Apple Computer, Inc.
  6. #
  7. #    Function:
  8. #    Compare two disks or folders, file by file, all the resources and data
  9. #    forks.  Also compare the file attributes too.  Generate a report showing
  10. #    the differences between the two disks or folders.  The report lists the
  11. #    differences file by file.
  12. #
  13. #    In-Outputs:
  14. #    The only input parameter is a single character. Either "d" or "f" for
  15. #    "disk" or "folder" modes.  There are no ouput parameters excepting the 
  16. #    parameter used by exit.  The exit status will be "2" if the script exits
  17. #    with an error.
  18. #        The output report is generated by this script and the scripts/tools 
  19. #    that it calls.  This output is written to the current MPW window.
  20. #
  21. #    Notes:
  22. #    Calls makelist and compare-disks scripts.
  23. #
  24.  
  25. #     Save the value of some MPW globals, restore at the end.
  26. set save-exit {exit}
  27. set exit 0                # exit=1 for exit on program error
  28. set save-echo {echo}
  29. set echo 0                # echo=1 for echoing each command before execution
  30. echo                    # Print blank line to seperate the report from stuff.
  31. echo "____________________________________________________________________________"
  32. echo
  33. echo "∂t∂t∂t∂t∂t∂tWelcome to the Localization Verifier"
  34. echo
  35. echo "The Localization Verifier will compare a US Master folder with a Localized"
  36. echo "folder.  A three part report will be generated for each of the files that are"
  37. echo "being compared.  The header for each of these reports looks like the following: " 
  38. echo
  39. echo "--------------------------------------------------------------------------------"
  40. echo "The following resources SHOULD NOT have differences but ARE different: "
  41. echo "--------------------------------------------------------------------------------"
  42. echo
  43. echo "∂t∂t∂t∂t∂**Resource specific information will go here **"
  44. echo
  45. echo "--------------------------------------------------------------------------------"
  46. echo "The following resources SHOULD have differences but do not (not yet localized?): "
  47. echo "--------------------------------------------------------------------------------"
  48. echo
  49. echo "∂t∂t∂t∂t∂**Resource specific information will go here **"
  50. echo
  51. echo "--------------------------------------------------------------------------------"
  52. echo "The following resources MAY or MAY NOT have differences."
  53. echo "This list is for your information only:"
  54. echo "--------------------------------------------------------------------------------"
  55. echo
  56. echo "∂t∂t∂t∂t∂**Resource specific information will go here **"
  57. echo
  58. echo "Primary differences in the reports will look like:"
  59. echo "    indm 999,    Contents match.  They should differ.  Not translated yet?"
  60. echo
  61. echo "Currently ∂"secondary∂" data comparision information will be interspersed throughout"
  62. echo "each of the three reports.  Secondary comparisons include the data fork, file attribute"
  63. echo "flags, resource file attribute flags, resource map flags, and finder attribute"
  64. echo "flags.  Look for three stars (***) at the beginning of a line to signal a secondary"
  65. echo "difference."
  66. echo
  67. echo "Missing resources will also be reported.  They will look like this:"
  68. echo
  69. echo "∂t*MISSING* Master file does not contain the following resource: itlk 9"
  70. echo
  71. echo "A perfect compare would report nothing.  It is also possible that *MISSING*"
  72. echo "resources should be missing from either the US or localized files.  This"
  73. echo "must be verified by the user."
  74. echo
  75. echo "•--------------------------------------------------------------------------------•"
  76. echo "                      Begin Report - `date`"
  77. echo "•--------------------------------------------------------------------------------•"
  78. echo
  79.  
  80.  
  81. #    Get the disk/folder ("d" or "f") parameter. 
  82. set folder "{1}"
  83.  
  84. #    Do we have a list of the file correspondences?  If not, make one.
  85. confirm -t "Make a correspondences file list?"
  86. set sstatus {status}            # Save the status
  87. if {sstatus} == 5                # Cancel button.
  88.     set exit {save-exit}
  89.     set echo {save-echo}
  90.     exit 2
  91.     
  92.     # The Yes button, set the name of the file and make the list.
  93. else if {sstatus} == 0
  94.     set filelist "`getfilename -q -m "Name a filelist" -b "New" -p ":Untitled filelist" || ∂
  95.         set ssstatus {status}`"        # Cancel button.
  96.     if {ssstatus} != 0
  97.         set exit {save-exit}
  98.         set echo {save-echo}
  99.         exit 2
  100.     end  # end of if cancel
  101.     echo "Creating new filelist: " "{filelist}"
  102.  
  103.     makelist "{filelist}" "{folder}"    # Make the list.
  104.     if {status} != 0                    # Cancel button in makelist
  105.         set exit {save-exit}
  106.         set echo {save-echo}
  107.         exit 2
  108.     end
  109.     
  110.     # The No button, select an existing file to use.
  111. else if {sstatus} == 4
  112.     set filelist "`getfilename -q -b Select -m "Select the correspondences file." || ∂
  113.         set ssstatus {status}`"    # Cancel button for select.
  114.     if {ssstatus} != 0
  115.         set exit {save-exit}
  116.         set echo {save-echo}
  117.         exit 2
  118.     end  # end of if cancel
  119.     echo "Using existing filelist: " "{filelist}"
  120. end
  121.     
  122.  
  123. #  Check for the disks being inserted.
  124. open "{filelist}"
  125. find • "{filelist}"
  126. find /•≈∞/ "{filelist}"                    # Get a line from filelist.
  127. if `count -l "{filelist}.§"` == 0        # Error if no file.
  128.     echo "Bad filelist."
  129.     set exit {save-exit}
  130.     set echo {save-echo}
  131.     exit 2
  132. end        # End of bad filelist.
  133. set aFile "`catenate "{filelist}.§"`"
  134. set problem 0                            # A sentinel.
  135.  
  136. #    I came across a bug where the "aFile" variable needs a leading ":" when 
  137. #    dealing with folder compares for the "exists" test.  So this is now special cased here.
  138. #    Kerry Laidlaw 1/31/90
  139.  
  140. if "{folder}" == f
  141.     set OldaFile "{aFile}"
  142.     set aFile ":{aFile}"
  143. end
  144.  
  145. # debugging here... echo {afile}        
  146.  
  147. if !`exists "{aFile}"`                        
  148.     alert "Cannot find the master files.  Please insert the master disk∂
  149.     or load the folder onto your system.  Then restart the command from the menu."
  150.     set problem 1
  151. end
  152. find /•≈∞/ "{filelist}"                    # Get a line from filelist.
  153. if `count -l "{filelist}.§"` == 0        # Error if no file.
  154.     echo "Bad filelist."
  155.     set exit {save-exit}
  156.     set echo {save-echo}
  157.     exit 2
  158. end        # End of bad filelist.
  159. set aFile "`catenate "{filelist}.§"`"
  160.     
  161. #    I came across a bug where the "aFile" variable needs a leading ":" when 
  162. #    dealing with folder compares for the "exists" test.  So this is now special cased here.
  163. #    Kerry Laidlaw 1/31/90
  164.  
  165. if "{folder}" == f
  166.     set OldaFile "{aFile}"
  167.     set aFile ":{aFile}"
  168. end
  169.  
  170. #    Following commented out so as not to reqire the test files to exist.
  171. #    This allows only those files in the test folder to be compared
  172. #if !`exists "{aFile}"`                
  173. #    alert "Cannot find the test files.  Please insert the test disk∂
  174. #    or load the folder onto your system.  Then restart the command from the menu."
  175. #    set problem 1
  176. #end
  177.  
  178. #    Now set the aFile variable back the way it was.  (Really not necessary yet.) *kl*
  179.     
  180. if "{folder}" == f
  181.     set aFile "{OldaFile}"
  182. end
  183.  
  184. close "{filelist}"
  185. if "{problem}" == 1
  186.     set exit {save-exit}
  187.     set echo {save-echo}
  188.     exit 2
  189. end
  190.  
  191. #    Do we have an "rNames" folder that contains all the resource names?  If not, make one. *kl*
  192. confirm -t "Make the rNames folder?"
  193. set sstatus {status}            # Save the status
  194. if {sstatus} == 5                # Cancel button.
  195.     set exit {save-exit}
  196.     set echo {save-echo}
  197.     exit 2
  198.     
  199.     # The Yes button, set the name of the file and make the list.***** Needs a lot of work!! *kl*
  200.     # The "rNames" files need to be created
  201. else if {sstatus} == 0
  202.     set rNames "`getfilename -d -q -m "Set directory for rNames folder." || ∂
  203.         set ssstatus {status}`"        # Cancel button.
  204.     if {ssstatus} != 0
  205.         set exit {save-exit}
  206.         set echo {save-echo}
  207.         exit 2
  208.     end  # end of if cancel
  209.     echo "Creating new rNames folder: " "{rNames}"rNames
  210.     echo
  211.     NewFolder "{rNames}"rNames             # Make the rNames folder.
  212.     if {status} != 0                    # The Folder creation was not successful
  213.         echo "The rNames folder creation was not successful."
  214.         echo "Try deleting it from the Finder and running Audit again."
  215.         set exit {save-exit}
  216.         set echo {save-echo}
  217.         exit 2
  218.     end
  219.     set rNames "{rNames}"rNames:            # Update rNames to include the folder name itself.
  220.  
  221.     # Now let's go create all the .rNames.S files....
  222.     # To flag the "compare-disks" routine that we only wish to create the rNames files
  223.     # let's set what is supposed to be the {folder} variable to 'zf' or 'zd' appropriately....
  224.     if ({folder} == "f")
  225.         set folder "zf"
  226.     else
  227.         set folder "zd"
  228.     end
  229.     compare-disks "{filelist}"    "{folder}" "{rNames}"    # And finally, create all the .rNames.S files....
  230.     exit 0    # Exit for now so the Verifier Editor Stack can be used to edit the rNames files.
  231.     
  232.     # Now set the folder var back so the next call of compare-disks will
  233.     # do the comparisions rather than do the special casing of generating
  234.     # the rNames files...
  235.     
  236.     #        Do we ever execute this code????  Wouldn't seem likely!
  237.     
  238.     echo "Wow!  I never thought this would display!"
  239.     
  240.     if ({folder} == "zf")
  241.         set folder "f"
  242.     else
  243.         set folder "d"
  244.     end
  245.     
  246.     # The No button, select an existing rNames folder to use.
  247. else if {sstatus} == 4
  248.     set rNames "`getfilename -d -q -m "Set directory to rNames folder." || ∂
  249.         set ssstatus {status}`"    # Cancel button for select.
  250.     if {ssstatus} != 0
  251.         set exit {save-exit}
  252.         set echo {save-echo}
  253.         exit 2
  254.     end  
  255.     echo "Using existing rNames folder: " "{rNames}"
  256. end
  257.  
  258. #     Compare the files.
  259. echo                                     # Add blank line to output.
  260. compare-disks "{filelist}"    "{folder}" "{rNames}"    # And finally, do the comparison.
  261. if "{folder}" == d            # If they are disks, eject them.
  262.     eject 1 2
  263. end
  264.  
  265. #    Cleanup and exit.
  266. set exit {save-exit}
  267. set echo {save-echo}
  268.  
  269. echo
  270. echo "•--------------------------------------------------------------------------------•"
  271. echo "                      End Report - `date`"
  272. echo "•--------------------------------------------------------------------------------•"
  273. echo
  274. beep 1e,4; beep 1c,5            # Make a pleasant tone to say I'm done.
  275. exit 0
  276.